<?php

/**
 * MlMachinesVersion filter form base class.
 *
 * @package    maslogger
 * @subpackage filter
 * @author     Michaël VEROUX
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseMlMachinesVersionFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'numero'                 => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'socle'                  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'emplacement'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'date_mise_service'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'numero_serie'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'numero_lecteur_carte'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'marque_id'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'jeux'                   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'date_cessation'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'destination_cessation'  => new sfWidgetFormFilterInput(),
      'token'                  => new sfWidgetFormChoice(array('choices' => array('' => '', 'coinless' => 'coinless', '0,01' => '0,01', '0,02' => '0,02', '0,05' => '0,05', '0,10' => '0,10', '0,20' => '0,20', '0,50' => '0,50', 1 => '1', 2 => '2', 5 => '5', 10 => '10', 20 => '20'))),
      'bill_acceptor'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'tito'                   => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'cashless'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'taux_de_redistribution' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'denomination'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'created_at'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'deleted_at'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'numero'                 => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'socle'                  => new sfValidatorPass(array('required' => false)),
      'emplacement'            => new sfValidatorPass(array('required' => false)),
      'date_mise_service'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'numero_serie'           => new sfValidatorPass(array('required' => false)),
      'numero_lecteur_carte'   => new sfValidatorPass(array('required' => false)),
      'marque_id'              => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'jeux'                   => new sfValidatorPass(array('required' => false)),
      'date_cessation'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'destination_cessation'  => new sfValidatorPass(array('required' => false)),
      'token'                  => new sfValidatorChoice(array('required' => false, 'choices' => array('coinless' => 'coinless', '0,01' => '0,01', '0,02' => '0,02', '0,05' => '0,05', '0,10' => '0,10', '0,20' => '0,20', '0,50' => '0,50', 1 => '1', 2 => '2', 5 => '5', 10 => '10', 20 => '20'))),
      'bill_acceptor'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'tito'                   => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'cashless'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'taux_de_redistribution' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'denomination'           => new sfValidatorPass(array('required' => false)),
      'created_at'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'deleted_at'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('ml_machines_version_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'MlMachinesVersion';
  }

  public function getFields()
  {
    return array(
      'id'                     => 'Number',
      'numero'                 => 'Number',
      'socle'                  => 'Text',
      'emplacement'            => 'Text',
      'date_mise_service'      => 'Date',
      'numero_serie'           => 'Text',
      'numero_lecteur_carte'   => 'Text',
      'marque_id'              => 'Number',
      'jeux'                   => 'Text',
      'date_cessation'         => 'Date',
      'destination_cessation'  => 'Text',
      'token'                  => 'Enum',
      'bill_acceptor'          => 'Boolean',
      'tito'                   => 'Boolean',
      'cashless'               => 'Boolean',
      'taux_de_redistribution' => 'Number',
      'denomination'           => 'Text',
      'created_at'             => 'Date',
      'updated_at'             => 'Date',
      'deleted_at'             => 'Date',
      'version'                => 'Number',
    );
  }
}
